<html>
<?php
include 'config.php';
include 'opendb.php';
include 'header.php';

//	declare variables
$chartimg="";
$baseurl="";
$chd="";
$chxl="";
$strLength="";
$row="";

//	select the data
$result = mysql_query("SELECT schema_name FROM SCHEMATA limit 8;") or die(mysql_error());  

//	loop through the data building the dataset
while($row = mysql_fetch_array( $result )) {
	$strLength = strlen($row['schema_name']);
	$chd = $chd.$strLength.",";
	$strName = $row['schema_name'];
	$chxl = $chxl.$strName."|";
	} 
$chd = rtrim($chd, "\,");
$chxl = rtrim($chxl, "\|");

//	p3 chart
$baseurl="http://chart.apis.google.com/chart?cht=p3&chs=300x100&chco=cc0000&chxt=x&chd=t:";
$chartimg = "<img src=".$baseurl.$chd."&chxl=0:|".$chxl."><br>";
echo $chartimg;
echo $baseurl.$chd."&chxl=0:|".$chxl."<hr>";

//	bvs chart
$baseurl="http://chart.apis.google.com/chart?cht=bvs&chs=800x150&chco=cc00ff&chbh=30,50&chxt=x&chd=t:";
$chartimg = "<img src=".$baseurl.$chd."&chxl=0:|".$chxl."><br>";
echo $chartimg;
echo $baseurl.$chd."&chxl=0:|".$chxl."<hr>";

//	bhs chart
$baseurl="http://chart.apis.google.com/chart?cht=bhs&chs=200x240&chco=4D89F9&chxt=y&chd=t:";
$chartimg = "<img src=".$baseurl.$chd."&chxl=0:|".$chxl."><br>";
echo $chartimg;
echo $baseurl.$chd."&chxl=0:|".$chxl."<hr>";

include 'closedb.php';

/*
//	examples of actual URLs that are generated
//http://chart.apis.google.com/chart?cht=p3&chs=300x150&chco=cc0000&chxt=x&chd=t:18,11,5,6,10&chxl=0:|information_schema|action_logs|click|django|drupal616a
//http://chart.apis.google.com/chart?cht=bvs&chs=300x150&chco=cc00ff&chxt=x&chd=t:18,11,5,6,10&chxl=0:|information_schema|action_logs|click|django|drupal616a
//	original example of displaying data in a table
echo "<table border='1'>";
echo "<tr> <th>schema_name</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	// Print out the contents of each row into a table
	echo "<tr><td>"; 
	echo $row['schema_name'];
	echo "</td></td>"; 
} 
echo "</table>";
*/

include 'footer.php';
?>
</html>
